//
//  AppTools.m
//  豆瓣2
//
//  Created by dllo on 15/11/6.
//  Copyright (c) 2015年 张鸿峰. All rights reserved.
//

#import "AppTools.h"

#import "AFNetworking.h"

@implementation AppTools


+ (void)getLocalDataWithURL:(NSString *)url Block:(AppToolsBlock)appBlock
{
    NSString *urlEncode = [url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/plain",@"text/json",@"application/json",@"text/javascript",@"text/html", nil];
    [manager GET:urlEncode parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
//        NSLog(@"使用AFN进行get请求 = = =%@",responseObject);
        
        appBlock(responseObject);
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
        NSLog(@"请求失败  = = %@",error);
    }];
    
    
    
}



@end
